package cn.appsys.pojo;

import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Super Cui on 2017/10/14.
 */
public class Category {
    private Long id;                //主键ID
    private String categoryCode;    //分类编码
    private String categoryName;    //分类名称
    private Long parentId;          //父级节点id
    private Long createdBy;         //创建者（来源于backend_user用户表的用户id）
    @DateTimeFormat
    private Date creationTime;     //创建时间
    private Long modifyBy;          //更新者（来源于backend_user用户表的用户id）
    @DateTimeFormat
    private Date modifyDate;        //最新更新时间

    /**
     * constructor
     */
    public Category() {
    }

    /**
     * constructor
     * @param id
     */
    public Category(Long id) {
        this.id = id;
    }

    /**
     * constructor
     * @param id
     * @param categoryCode
     * @param categoryName
     * @param parentId
     * @param createdBy
     * @param creationTime
     * @param modifyBy
     * @param modifyDate
     */
    public Category(Long id, String categoryCode, String categoryName, Long parentId, Long createdBy, Date creationTime, Long modifyBy, Date modifyDate) {
        this.id = id;
        this.categoryCode = categoryCode;
        this.categoryName = categoryName;
        this.parentId = parentId;
        this.createdBy = createdBy;
        this.creationTime = creationTime;
        this.modifyBy = modifyBy;
        this.modifyDate = modifyDate;
    }

    @Override
    public String toString() {
        return "Category{" +
                "id=" + id +
                ", categoryCode='" + categoryCode + '\'' +
                ", categoryName='" + categoryName + '\'' +
                ", parentId=" + parentId +
                ", createdBy=" + createdBy +
                ", creationTime=" + ((creationTime != null) ? (new SimpleDateFormat("yyyy-MM-dd").format(creationTime)) : "") +
                ", modifyBy=" + modifyBy +
                ", modifyDate=" + ((modifyDate != null) ? (new SimpleDateFormat("yyyy-MM-dd").format(modifyDate)) : "") +
                '}';
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(Long createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(Date creationTime) {
        this.creationTime = creationTime;
    }

    public Long getModifyBy() {
        return modifyBy;
    }

    public void setModifyBy(Long modifyBy) {
        this.modifyBy = modifyBy;
    }

    public Date getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) {
        this.modifyDate = modifyDate;
    }
}
